home *** CD-ROM | disk | FTP | other *** search
/ Super PC 34 / Super PC 34 (Shareware).iso / spc / UTIL / DJGPP2 / V2 / DJLSR200.ZIP / src / libc / dos / io / setmode.txh < prev    next >
Encoding:
Text File  |  1995-07-25  |  876 b   |  35 lines

  1. @node setmode, io
  2. @subheading Syntax
  3.  
  4. @example
  5. #include <io.h>
  6.  
  7. int setmode(int file, int mode);
  8. @end example
  9.  
  10. @subheading Description
  11.  
  12.  
  13. This function sets the mode of the given @var{file} to @var{mode}, which
  14. is either @code{O_TEXT} or @code{O_BINARY}.  It will also set the file
  15. into either cooked or raw mode accordingly, and set any @code{FILE*}
  16. objects that use this file into text or binary mode. 
  17.  
  18. Note that, for buffered streams (@code{FILE*}), you must call
  19. @code{fflush} (@pxref{fflush}) before @code{setmode}, or call
  20. @code{setmode} before writing anything to the file, for proper
  21. operation.
  22.  
  23. @subheading Return Value
  24.  
  25. When successful, the function will return the previous mode of the
  26. given @var{file}.  In case of failure, -1 is returned and @var{errno}
  27. is set.
  28.  
  29. @subheading Example
  30.  
  31. @example
  32. setmode(0, O_BINARY);
  33. @end example
  34.  
  35.